﻿using DXApplicationTangche.UC.抖音出入库.Service;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DXApplicationTangche.UC.抖音出入库
{
    public partial class Form抖音退货一览 : DevExpress.XtraEditors.XtraForm
    {
        public Form抖音退货一览()
        {
            InitializeComponent();
            this.刷新();
        }

        private void simpleButton刷新_Click(object sender, EventArgs e)
        {
            this.刷新();
        }
        private void 刷新()
        {
            this.gridControl抖音退货一览.DataSource = 抖音订单Service.getDouyinOrderAfterSaleList();
            this.gridView抖音退货一览.RefreshData();
        }

        private void gridView抖音退货一览_RowCellStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e)
        {
            try
            {
                if (e.RowHandle >= 0)
                {
                    ViewDouyinOrderAfterSaleDao douyinOrderAfterSaleDao = (ViewDouyinOrderAfterSaleDao)gridView抖音退货一览.GetRow(e.RowHandle);
                    if (String.IsNullOrEmpty(douyinOrderAfterSaleDao.logisticsOrderNo))
                    {
                        if (e.Column.Name.Equals("gridColumn退货物流单号"))
                        {
                            e.Appearance.BackColor = Color.OrangeRed;
                        }
                    }
                }
            }
            catch { }
        }

        private void simpleButton导出excel_Click(object sender, EventArgs e)
        {
            SaveFileDialog fileDialog = new SaveFileDialog();
            fileDialog.Title = "导出excel";
            fileDialog.Filter = "Excel文件(*.xlsx)|*.xlsx";
            DialogResult dialogResult = fileDialog.ShowDialog(this);
            if (dialogResult == DialogResult.OK)
            {
                DevExpress.XtraPrinting.XlsExportOptions options = new DevExpress.XtraPrinting.XlsExportOptions();
                this.gridView抖音退货一览.ExportToXlsx(fileDialog.FileName);
                DevExpress.XtraEditors.XtraMessageBox.Show("文件已保存至" + fileDialog.FileName, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

        }
    }
}
